import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      name: 'home',
      component: () => import('../views/Home.vue')
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/Login.vue')
    },
    {
      path: '/problems',
      name: 'problems',
      component: () => import('../views/Problems.vue')
    },
    {
      path: '/problem/upload',
      name: 'problem-upload',
      component: () => import('../views/ProblemUpload.vue'),
      meta: { requiresTeacher: true }
    },
    {
      path: '/problem/:id',
      name: 'problem-detail',
      component: () => import('../views/ProblemDetail.vue')
    },
    {
      path: '/classroom',
      name: 'classes',
      component: () => import('../views/Classes.vue')
    },
    {
      path: '/personal',
      name: 'personal-space',
      component: () => import('../views/PersonalSpace.vue')
    },
    {
      path: '/points-ranking',
      name: 'points-ranking',
      component: () => import('../views/PointsRanking.vue')
    },
    {
      path: '/discussions',
      name: 'discussions',
      component: () => import('../views/DiscussionList.vue')
    },
    {
      path: '/discussion/create',
      name: 'discussion-create',
      component: () => import('../views/DiscussionCreate.vue'),
      meta: { requiresAuth: true }
    },
    {
      path: '/discussion/:id',
      name: 'discussion-detail',
      component: () => import('../views/DiscussionDetail.vue')
    }
  ]
})

export default router